<template>
  <div class="user">
    <div class="left">
      <router-link :to="{ name: 'Info' }">用户信息</router-link>
      <router-link :to="{ name: 'ChangePwd' }">修改密码</router-link>
      <router-link :to="{ name: 'Orders' }">我的订单</router-link>
      <router-link :to="{ name: 'Score' }">我的积分</router-link>
    </div>
    <div class="right">
      <router-view></router-view>
    </div>
  </div>
</template>

<script>
export default {
  created() {
    if (localStorage.getItem('token')) {
      this.$router.push({ name: 'Info' })
    } else {
      this.$router.push({ name: 'Login' })
    }
  }
}
</script>

<style scoped>
.user {
  display: flex;
}
.user .left {
  width: 160px;
  display: flex;
  flex-direction: column;
}
.user .right {
  flex: 1;
  border: 0.02rem solid orchid;
}
</style>
